package com.dx.mes.service.spc.util;

import com.dx.mes.service.spc.rtnBean.SpcRuleCheckItem;
import org.drools.KnowledgeBase;
import org.drools.runtime.StatefulKnowledgeSession;

public class DroolsUtil {
    private StatefulKnowledgeSession ksession;
    private KnowledgeBase kbase;

    public StatefulKnowledgeSession getKsession() {
        return ksession;
    }

    public void setKsession(StatefulKnowledgeSession ksession) {
        this.ksession = ksession;
    }

    public KnowledgeBase getKbase() {
        return kbase;
    }

    public void setKbase(KnowledgeBase kbase) {
        this.kbase = kbase;
    }

    public void TestRules(SpcRuleCheckItem spcRuleCheckItem, int maxCnt) {
        ksession.insert(spcRuleCheckItem);
        ksession.setGlobal("MAX_SPC_VALUE_CNT", maxCnt);
        ksession.fireAllRules();
    }
}
